"""函数"""
import self

# str1="sdasfasdasf"
# str2="dfasasdsad"
# str3="hgfcvbxkj"
#
# sum=0
# for i in str1:
#     sum=sum+1
# print(f"长度是{sum}")
#
# def say_hai():
#     print("Hello")
# say_hai()

"""参数"""
# def compute(a,b):
#     result=a+b
#     print(result)
# compute(2,3)

"""返回值"""
# def compute(a,b):
#     result = a+b
#     return result
# sum=compute(10,20)
# print(sum)

"""None类型"""
# def say():
#     print("Hello Word")
# type=say()
# print(type)

# def judge(age):
#     """
#     judge函数可以接收一个参数，用来判断年龄是否满18岁
#     :param age: 接收传入的参数
#     :return: 返回判断的结果
#     """
#     if age<18:
#         return None
#     else:
#         return "success"
# result=judge(21)
# if result==None:
#     print("未成年")
# else:
#     print(result)

"""函数的嵌套调用"""
# def function_b():
#     print("2")
# def function_a():
#     print("1")
#     function_b()
#     print("3")
# function_a()

"""局部变量"""
# def test_a():
#     num=100
#     print(num)
# test_a()
# print(num)

"""全局变量"""
# num=100
# def test_a():
#     print(num)
# test_a()
# print(num)

"""global关键字"""
# num=100
# def test_a():
#     global num
#     num=200
#     print(num)
# test_a()
# print(num)

